<template>
    <p>{{ name }}</p>
    <p>{{ like }}</p>
    <button @click="change">81变</button>
</template>

<script lang="ts" setup>
import { sr } from 'element-plus/es/locales.mjs';
import { reactive, toRefs } from 'vue';


const state = reactive({
    name: "刘志强",
    like: "霸王茶姬"
})
//解构赋值无法做到响应式
// let {name, like} = state

let { name, like} = toRefs(state)

function change(){
    //like = "窝窝头"
    like.value = "窝窝头"
    console.log(state.like)
    
}
</script>